﻿@model XPressify.Models.RelationshipLoveEditModel
@using XPressify.Data.Helpers
@using XPressify.Controllers
@using Omu.Awesome.Core;
@using Omu.Awesome.Mvc.Helpers;

@{
    ViewBag.Title = "Relationship edit";
}


<script type="text/javascript">
    $('#myDropdownList').change(function () {
        var dropdown = $('#myDropdownList');
        if(dropdown.val() == "-1" ||
           dropdown.val() == "15" ||
           dropdown.val() == "17" ||
           dropdown.val() == "18") {
            $('#mySelectUser').fadeOut("slow");
        }
        else {
            $('#mySelectUser').fadeIn("slow")
        }
    });

        
    </script>


@if(Model.AnyPreviousRelationship)
{
    <div style="text-align:left">
    @(Html.MakePopupForm<ProfileController>(o => o.RelationshipLoveDelete(), title: "Are you sure you want to delete this relationship?", height: 300, width: 550, okText: "", resizable: false, refreshOnSuccess: true))
    @(Html.PopupFormActionLink<ProfileController>(o => o.RelationshipLoveDelete(), "Delete", new { @class = "nobtn" }))
    previous relationship.
    </div>
}
else
{
    
    using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend style="font-size:x-large;color:#222">Edit relationship</legend>

            <div class="editor-label">
                @Html.LabelFor(model => model.RelationshipType) :
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.RelationshipType, new List<SelectListItem> {new SelectListItem { Text = "In relationship", Value = RelationshipType.InRelationshipWith.ToString() }, new SelectListItem { Text = "Complicate", Value = RelationshipType.ItsComplicatedWith.ToString() }, new SelectListItem { Text = "Married", Value = RelationshipType.MarriedWith.ToString() }, new SelectListItem { Text = "Engaged", Value = RelationshipType.EngagedWith.ToString() }, new SelectListItem { Text = "Single", Value = RelationshipType.IsSingle.ToString() }, new SelectListItem { Text = "Open relationship", Value = RelationshipType.OpenRelationshipWith.ToString() }, new SelectListItem { Text = "Widowed", Value = RelationshipType.IsWidowed.ToString() }, new SelectListItem { Text = "Divorced", Value = RelationshipType.IsDivorced.ToString() } }, new { id = "myDropdownList"})
                @Html.ValidationMessageFor(model => model.RelationshipType)
            </div>
        
            <div id="mySelectUser">
            <label>Select user:</label>
            <input type="hidden" value="@Model.CurrentUserId" name="myCurrentUserId" id="myCurrentUserId" />
            <ul class='ae-lookup-list'>
                @Html.LookupFor(o => o.SelectedUser, controller: "FriendsLookup", multiselect: false, clearButton: true, title: "Select friend", data: new Dictionary<string, string> { { "myCurrentUserId", "currentUserIdString" } })
            </ul>
            </div>

            <br /> <br /> <br /> <br />
             <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>
    }
    
}


